# Replication archive for: Coppock, Alexander and Seth J. Hill and Lynn Vavreck. 2020. "The Small Effects of Political Advertising are Small Regardless of Context, Message, Sender, or Receiver: Evidence from 59 Real-time Randomized Experiments" Science Advances, forthcoming.

# design table ------------------------------------------------------------
library(tidyverse)
library(janitor)
library(xtable)

exps <- read_rds("exps.rds")

exps <- 
  exps %>%
  mutate(
    date_formated = format(date, format = "%B %d"),
    date_formated = fct_reorder(factor(date_formated), date)
  )


# Create design table and export ------------------------------------------

design_table <-
  exps %>%
  tabyl(date_formated, assignment) %>%
  adorn_totals(where = c("row", "col"))

design_table[design_table == 0] <- NA

design_table %>%
  xtable(digits = 0) %>%
  print.xtable(
    include.rownames = FALSE,
    include.colnames = FALSE,
    only.contents = TRUE,
    hline.after = c(),
    add.to.row = list(pos = list(29), command = "\\midrule "),
  )

